package javaScript 
{
	import flash.external.ExternalInterface;
	/**
	 * 呼叫javascript
	 * @author cain in liontravel 2010
	 */
	public class JavaSP
	{
		/**
		 * 是否可使用js
		 */
		public function get canUserJs():Boolean 
		{
			return ExternalInterface.available;
		}
		/**
		 * 跳出視窗
		 * @param	_str 內容
		 */
		public function alert(_str:String = ""):void 
		{
			if (canUserJs) 
			{
				ExternalInterface.call(JSScripts.alert,_str);
			}else 
			{
				trace("alert:" + _str);
			}
			
		}
		/**
		 * 另開視窗
		 * @param	_url 網址
		 * @param	_name 名稱
		 * @param	_ww 寬
		 * @param	_hh 高
		 */
		public function windowOpen(_url:String, _name:String = "", _ww:int = 100,_hh:int = 100 ):void 
		{
			if (canUserJs) 
			{
				ExternalInterface.call(JSScripts.windowOpen, _url, _name, "'" + _ww + "'", "'" + _hh + "'");
			}else 
			{
				trace("windowOpen:" + _url);
			}
		}
		public function reload():void 
		{
			if (canUserJs) 
			{
				ExternalInterface.call(JSScripts.reload);
			}else 
			{
				trace("重新整理");
			}
		}
	}

}